home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Developer Utilities / Installer 4.0GM SDK / Script Examples / Version Compare / File Version Compare / File Compare with Proc / File Compare Proc.r < prev    next >
Encoding:
Text File  |  1994-02-10  |  1.9 KB  |  83 lines  |  [TEXT/MPS ]

  1. #include "InstallerTypes.r"
  2.  
  3. include "GetFileVersion";
  4.  
  5. //  This script is set up to use a custom version proc to determine whether
  6. //  or not to replace/update an existing file.
  7. //  This is the recommended way of determining whether or not to update an
  8. //  existing file.
  9.  
  10. //  If the correct flags are set, Installer will compare the 'vers' 1 resource
  11. //  the existing target file with the version hard-coded in the 'infa'
  12. //  of the source file.
  13.  
  14. //  The following flags must be set:
  15. //        copy, useSrcCrDateToCompare, leaveAloneIfNewer, & update existing.
  16. //  also the 'infa' must have the source version hard-coded in BCD format.
  17.  
  18.  
  19. resource 'inpk' (100) {
  20.     format0 {
  21.         showsOnCustom,
  22.         removable,
  23.         dontForceRestart,
  24.         0,
  25.         0,
  26.         "Copy File Read Me from Tidbits Disk....",
  27.         {    'infa', 1000    },
  28.         }
  29.     };
  30.  
  31. resource 'infa' (1000) {
  32.     format1 {
  33.         deleteWhenRemoving,
  34.         deleteWhenInstalling,
  35.         copy,                            //  Copy on Install
  36.         dontIgnoreLockedFile,
  37.         dontSetFileLocked,
  38.         useVersProcToCompare,            //  Use creation date for compare
  39.         srcNeedExist,
  40.         rsrcForkInRsrcFork,
  41.         leaveAloneIfNewer,                //  Do not update a newer file
  42.         updateExisting,                    //  Update an existing file
  43.         copyIfNewOrUpdate,
  44.         rsrcFork,
  45.         dataFork,
  46.         0,
  47.         0x0,
  48.         10000,
  49.         {    20000, 0, 0    },
  50.         0x07107fff,                        //  The source version number in BCD format minus 1
  51.         128,                            //  MUST be the 'invc' id of the custom version proc
  52.         0,
  53.         "Read Me"
  54.         }
  55.     };
  56.  
  57. resource 'invc' (128) {
  58.     format0 {
  59.         'infn',                            //  The resource type of the actual custom proc
  60.         128,                            //  The resource id of the actual custom proc
  61.         1024,                            //  The minimum amount of memory needed by the proc
  62.         "Returns vers 2 version number.",
  63.         }
  64.     };
  65.  
  66. resource 'infs' (10000) {
  67.     'ttro',
  68.     'ttxt',
  69.     0x0,
  70.     noSearchForFile,
  71.     TypeCrMustMatch,
  72.     ":Read Me"
  73.     };
  74.  
  75. resource 'infs' (20000) {
  76.     'ttro',
  77.     'ttxt',
  78.     0x1,
  79.     noSearchForFile,
  80.     TypeCrMustMatch,
  81.     "Tidbits:Apple Utilities:Read Me"    //  System 7.1 Tidbits FDHD diskette
  82.     };
  83.